🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / core / repository / src / commonMain / kotlin / org / meshtastic / core / repository / AwaitedSendResult.kt
Displaying Raw • Download
core/repository/src/commonMain/kotlin/org/meshtastic/core/repository/AwaitedSendResult.kt 4651c85361d890ee3b0ac02ea3fc5b185e97033e (4651c853) Text, 3.44 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.repository
T8b949e/** Outcome of a packet whose caller waited for transport admission and any required routing result. */
Tff7b72enum Tff7b72class T56d364AwaitedSendStatus Tb4b4b4{
T8b949e/** The radio acknowledged the packet, or firmware completed synchronous local-loopback delivery. */
Te6edf3ACCEPTEDTb4b4b4,
T8b949e/** The app rejected the packet before it reached a transport, such as an invalid or duplicate packet ID. */
Te6edf3REJECTEDTb4b4b4,
T8b949e/** The transport dispatched the packet, but the radio rejected it. */
Te6edf3RADIO_REJECTEDTb4b4b4,
T8b949e/** No required radio response arrived within the response window after transport admission. */
Te6edf3TIMED_OUTTb4b4b4,
T8b949e/**
* The queue or owning service scope stopped before the radio answered. Inspect [AwaitedSendResult.dispatched]
* before retrying because the transport can stop after admission.
*/
Te6edf3TRANSPORT_STOPPEDTb4b4b4,
T8b949e/** No transport accepted the bytes, or the send attempt raised an error. */
Te6edf3SEND_FAILEDTb4b4b4,
Tb4b4b4}
T8b949e/**
* Detailed result for an awaited send. [departureEpochAtDispatch] captures the canonical departure counter when an
* active transport accepts the outbound bytes for asynchronous delivery. Its presence is also the single source of
* truth for [dispatched], allowing callers to distinguish a later transport departure from one that happened while the
* packet was still queued. Correlated responses received before dispatch are ignored, so an accepted result always
* belongs to an admitted transport send.
*/
Tff7b72data Tff7b72class T56d364AwaitedSendResultTb4b4b4(Tff7b72val Te6edf3statusTb4b4b4: Te6edf3AwaitedSendStatusTb4b4b4, Tff7b72val Te6edf3departureEpochAtDispatchTb4b4b4: Tffa657Long? Tff7b72= Tff7b72nullTb4b4b4) Tb4b4b4{
T8b949e/** True only when an active transport admitted the outbound bytes. */
Tff7b72val Te6edf3dispatchedTb4b4b4: Tffa657Boolean
Tff7b72getTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3departureEpochAtDispatch Tff7b72!Tff7b72= Tff7b72null
Tff7b72val Te6edf3acceptedTb4b4b4: Tffa657Boolean
Tff7b72getTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3status Tff7b72=Tff7b72= Te6edf3AwaitedSendStatusTb4b4b4.Te6edf3ACCEPTED
T8b949e// TRANSPORT_STOPPED intentionally has no dispatch invariant: teardown can win before or after byte admission.
Tff7b72init Tb4b4b4{
Te6edf3requireTb4b4b4(Te6edf3status Tff7b72!Tff7b72= Te6edf3AwaitedSendStatusTb4b4b4.Te6edf3REJECTED Tff7b72|Tff7b72| Tff7b72!Te6edf3dispatchedTb4b4b4) Tb4b4b4{
Ta5d6ff"Ta5d6ffa REJECTED result must not come from an admitted transport sendTa5d6ff"
Tb4b4b4}
Te6edf3requireTb4b4b4(Te6edf3status Tff7b72!Tff7b72= Te6edf3AwaitedSendStatusTb4b4b4.Te6edf3RADIO_REJECTED Tff7b72|Tff7b72| Te6edf3dispatchedTb4b4b4) Tb4b4b4{
Ta5d6ff"Ta5d6ffa RADIO_REJECTED result must come from an admitted transport sendTa5d6ff"
Tb4b4b4}
Te6edf3requireTb4b4b4(Te6edf3status Tff7b72!Tff7b72= Te6edf3AwaitedSendStatusTb4b4b4.Te6edf3ACCEPTED Tff7b72|Tff7b72| Te6edf3dispatchedTb4b4b4) Tb4b4b4{
Ta5d6ff"Ta5d6ffan ACCEPTED result must come from an admitted transport sendTa5d6ff"
Tb4b4b4}
Te6edf3requireTb4b4b4(Te6edf3status Tff7b72!Tff7b72= Te6edf3AwaitedSendStatusTb4b4b4.Te6edf3TIMED_OUT Tff7b72|Tff7b72| Te6edf3dispatchedTb4b4b4) Tb4b4b4{
Ta5d6ff"Ta5d6ffa TIMED_OUT result must come from an admitted transport sendTa5d6ff"
Tb4b4b4}
Te6edf3requireTb4b4b4(Te6edf3status Tff7b72!Tff7b72= Te6edf3AwaitedSendStatusTb4b4b4.Te6edf3SEND_FAILED Tff7b72|Tff7b72| Tff7b72!Te6edf3dispatchedTb4b4b4) Tb4b4b4{
Ta5d6ff"Ta5d6ffa SEND_FAILED result must not claim transport dispatchTa5d6ff"
Tb4b4b4}
Tb4b4b4}
Tb4b4b4}
Served by rngit 1.5.4 - Generated in 0.09s